package com.sneakxy.cloudbase.platform.bean;

import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;

import com.sneakxy.mybatis.commons.annotations.Table;

import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 账号角色关联信息
 * @author 潜行的青衣
 * @see
 */
@Data
@Table("t_mb4j_account_role")
@EqualsAndHashCode(callSuper = false)
public class AccountRole extends BaseEntity<AccountRoleId> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8650714506858482256L;

	@Id
	private AccountRoleId id;
	
	@Transient
	private boolean isNew;
	
	public AccountRole() {}
	
	public AccountRole(AccountRoleId id, boolean isNew) {
		this.id = id;
		this.isNew = isNew;
	}
	
	public AccountRole(String accountId, String roleId) {
		this(new AccountRoleId(accountId, roleId), false);
	}
	
	public AccountRole(String accountId, String roleId, boolean isNew) {
		this(new AccountRoleId(accountId, roleId), isNew);
	}

	/* (non-Javadoc)
	 * @see com.sneakxy.cloudbase.base.bean.BaseEntity#isNew()
	 */
	@Override
	public boolean isNew() {
		return isNew || super.isNew();
	}

	/**
	 * @param isNew the isNew to set
	 */
	public void setNew(boolean isNew) {
		this.isNew = isNew;
	}
	
}
